!(function () {
    // text-scroll
    var height = 42;
    var pic = 0;
    var intervalTime = 3500;
    var transitionTime = 0.6;
    var direction = 'up';
    var textScrollBoxDom = document.getElementById('text-scroll-box');
    var firstTextScrollBoxDom = textScrollBoxDom.children[0].cloneNode('deep');
    var value = textScrollBoxDom.children.length + 1;
    textScrollBoxDom.appendChild(firstTextScrollBoxDom)
    setInterval(() => {
        textScrollBoxDom.style.transition = `all ${transitionTime}s`
        direction === 'up' ? pic += 1 : pic -= 1
        changePic(pic)
    }, intervalTime)


    function changePic(pic) {
        if (direction === 'up' && pic === value - 1) setReset(0)
        if (direction === 'down' && pic === 0) setReset(value - 1)
        var pics = -(pic * height) + 'px'
        textScrollBoxDom.style.transform = 'translateY(' + pics + ')'
    }
    function setReset(i) {
        setTimeout(() => {
            textScrollBoxDom.style.transition = ''
            pic = i
            changePic(pic)
        }, transitionTime * 1000)
    }
})()